<p>A very simple embedded Java web server with Undertow. Head over to <a href="http://undertow.io/">http://undertow.io/</a> to learn more about Undertow. This example is the same as shown on the homepage just written slightly differently. Undertow is the web server of choice for StubbornJava. It has a very clean and easy to follow API and has a fairly low learning curve. Every request and or filter is a HttpHandler. HttpHandlers can do filtering, routing, validation, exception handling and much more all with the same simple interface. Since the web server is embedded we can easily run this example insaide of any IDE or as a standalone executable Jar. No application containers in sight. Whew!</p>

<h2 class="anchored">Java Hello World Web Server</h2>
<p>A simple and lightweight Java HTTP server.</p>
{{> templates/src/widgets/code/code-snippet file=helloworld section=helloworld.sections.helloworld}}

<h2 class="anchored">Output</h2>
<pre class="line-numbers"><code class="language-bash">curl -X GET localhost:8080
Hello World!</code></pre>
<pre class="line-numbers"><code class="language-bash">curl -X GET localhost:8080/123
Hello World!</code></pre>
<p>Notice how all urls respond the same. Interested in <a href="/posts/url-routing-with-undertow-embedded-http-server">Routing with Undertow</a>?
